export default [
  {
    path: '/customer',
    component: () => import('@/views/layout/AppLayout.vue'),
    redirect: '/customer/list',
    meta: {
      title: '客户管理',
      icon: 'User',
      roles: ['admin', 'manager', 'analyst']
    },
    children: [
      {
        path: 'list',
        component: () => import('@/views/customer/CustomerListView.vue'),
        name: 'CustomerList',
        meta: { 
          title: '客户列表', 
          icon: 'Document'
        }
      },
      {
        path: 'detail/:id',
        component: () => import('@/views/customer/CustomerDetailView.vue').then(module => {
          console.log('CustomerDetailView组件加载完成');
          return module;
        }),
        name: 'CustomerDetail',
        meta: {
          title: '客户详情',
          icon: 'InfoFilled',
          activeMenu: '/customer/list',
          hidden: true
        },
        // 强制每次都重新创建组件实例
        beforeEnter: (to, from, next) => {
          console.log('进入客户详情页面:', to.params.id);
          console.log('来源页面:', from.path);
          next();
        }
      },
      {
        path: 'detail',
        component: () => import('@/views/customer/CustomerIdSelector.vue'),
        name: 'CustomerSelector',
        meta: { 
          title: '选择客户', 
          icon: 'Search'
        }
      },
      {
        path: 'test',
        component: () => import('@/views/customer/CustomerTestView.vue'),
        name: 'CustomerTest',
        meta: {
          title: 'API测试',
          icon: 'Monitor'
        }
      },
      {
        path: 'generate',
        component: () => import('@/views/customer/CustomerDataGenerator.vue').then(module => {
          console.log('CustomerDataGenerator组件加载完成');
          return module;
        }),
        name: 'CustomerDataGenerator',
        meta: {
          title: '客户数据获取',
          icon: 'DataAnalysis',
          roles: ['admin', 'analyst']
        },
        // 强制每次都重新创建组件实例
        beforeEnter: (to, from, next) => {
          console.log('进入数据生成器页面:', to.path);
          console.log('来源页面:', from.path);
          next();
        }
      }
    ]
  }
] 